let list = [
    {"id":"1","title": "威海2018年体育中考内容出炉炉","date":"20180209"},
    {"id":"2","title": "小年开始威海市区将进入亮灯模","date":"20180209"},
    {"id":"3","title": "威海市图书馆2月8日免费送春","date":"20180208"},
    {"id":"4","title": "92号汽油每升上涨5分钱分钱分","date":"20180208"},
    {"id":"5","title": "市民可免费领手绘版“威海文化","date":"20180208"},
    {"id":"6","title": "首批52辆新能源车23日上牌分","date":"20180208"},
    {"id":"7","title": "高区幼儿园招聘24名幼儿教师","date":"20180207"},
    {"id":"8","title": "威海-北京新增春节加班航班炉","date":"20180207"}
];
console.log( typeof list);

function groupBy(array,f) {
    let groups = {};
    console.log( typeof  array);
    array.forEach(function (v) {
        let group = JSON.stringify(f(v));
        // let group = f(v);
        groups[group] = groups[group] || [];
        groups[group].push(v);
        // groups[group]['date'] = groups[group]['date'] || [];
        // groups[group]['list'] = groups[group]['list'] || [];
        // groups[group]['date'] = f(v);
        // groups[group]['list'].push(v);
    });
    return groups;
}
let arr = groupBy(list, v => v.date);

console.log(arr)
console.log( typeof  arr);
// console.log(Array.isArray(arr));//false
console.log()

//
// arr.forEach(
//     (v) => {
//         console.log(v)
//     }
// )

// var aa = [1,2,3,4]
// var bb = a.forEach()
// console.log(bb)
// console.log(arr.map(n=>n<0))

// const aa = ['a', 'b', 'c'];
// console.log(aa);

// aa.forEach(function(element) {
//     console.log(element);
// });















// console.log(Array.of(3, 11, 8))